﻿@{
    ExChange.Model.Admin loginAdmin = (ExChange.Model.Admin)ViewBag.LoginAdmin;
}
<!DOCTYPE html>
<style>
    .fitem label {
        display: inline-block;
        margin-top: 10px;
        width: 110px;
    }
</style>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <link href="~/EasyuUI/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/EasyuUI/themes/icon.css" rel="stylesheet" />
    <link href="~/Content/css/frame.css" rel="stylesheet" />
    @*<script src="~/Content/js/jquery-3.1.1.min.js"></script>*@
    <script src="~/EasyuUI/jquery-1.10.2.min.js"></script>
    @*<script src="~/Content/js/jquery.js"></script>*@

    <script src="~/EasyuUI/jquery.easyui.min.js"></script>
    <script src="~/EasyuUI/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <div class="tc_top">
        <div class="tc_top_logo">
            <img src="/Content/images/Logo.png" height="25" />
        </div>
        <div class="tc_top_tab">
            <a href="/Member/Index" id="tc_home_index" class="tc_top_tab_option" data-id="0">
                <span class="tc_tab_opion_title">会员管理</span>
            </a>
            <a href="/Member_Ware/Index" id="tc_home_index" class="tc_top_tab_option" data-id="0">
                <span class="tc_tab_opion_title">会员等级管理</span>
            </a>
            <a href="/Ware/Index" id="tc_home_index" class="tc_top_tab_option tc_a_active" data-id="0">
                <span class="tc_tab_opion_title">商品管理</span>
            </a>
            <a href="/Order/Index" id="tc_home_index" class="tc_top_tab_option" data-id="0">
                <span class="tc_tab_opion_title">订单管理</span>
            </a>
            <a href="/Order/OrderTongJi" id="tc_home_index" class="tc_top_tab_option" data-id="0">
                <span class="tc_tab_opion_title">兑换统计</span>
            </a>
            <a href="/Setting/Index" id="tc_home_index" class="tc_top_tab_option" data-id="0">
                <span class="tc_tab_opion_title">网站设置</span>
            </a>
        </div>
        <div class="tc_top_info">
            <img src="~/Content/images/admin.jpg" onclick="javascript:$('.info_win').fadeToggle(300);" />
            <div class="info_win">
                <div style="width: 150px;text-align: center; font-size: 12px;padding: 10px 0;color: #1482b4;border-bottom:1px solid #d2d2d2;">
                    当前登录 @loginAdmin.Name
                </div>
                <a href="#" class="win_option" onclick="UpdatePwd()">
                    <img src="/Content/icons/key.png" alt="">修改密码
                </a>
                <a href="/Home/LoginOut" class="win_option">
                    <img src="/Content/icons/exit.png" alt="">退出登录
                </a>
            </div>
        </div>
    </div>
    <div class="tc_panel">
        @RenderBody()
    </div>
</body>
</html>

<div id="pwddlg" modal="true" class="easyui-dialog" style="width:400px;height:300px;padding:10px 20px" closed="true" buttons="#pwddlg-buttons">
    <form id="pwdfm" method="post">
        <div class="fitem" style="width:100%;">
            <label>新密码</label>
            <input id="password" name="password" validtype="length[4,32]" class="easyui-validatebox" required="true" type="password" value="" />
        </div>
        <div class="fitem" style="width:100%;">
            <label>确认密码</label>
            <input type="password" name="repassword" id="repassword" required="true" class="easyui-validatebox" validtype="equalTo['#password']" invalidmessage="两次输入密码不匹配" />
        </div>
    </form>
</div>
<div id="pwddlg-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="UpdatePwdsave()" style="width:90px">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript: $('#pwddlg').dialog('close')" style="width:90px">取消</a>
</div>
<script>
    function UpdatePwdsave() {
        debugger;
        var password = $("#password").val();
        $('#pwdfm').form('submit', {
            url: '/Home/UpdatePwd?password=' + password,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                var result = eval('(' + result + ')');
                if (result.success == true) {
                    $('#dlg').dialog('close');        // 关闭弹出框
                    $('#dg').datagrid('reload');    // 重新加载表数据

                } else {
                    $.messager.alert('错误', '操作失败！');
                }
            }
        });
    }

    $.extend($.fn.validatebox.defaults.rules, {
        /*必须和某个字段相等*/
        equalTo: {
            validator: function (value, param) {
                return $(param[0]).val() == value;
            },
            message: '字段不匹配'
        }
    });


    function UpdatePwd() {
        $('#pwddlg').dialog({
            title: '修改密码',
            closed: false,
            cache: false,
            modal: true
        }).dialog('center');
        $('#pwdfm').form('clear');//清空表单
    }
</script>